<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>员工企业变更记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../js/layui.2.6.8/css/layui.css" media="all">
<!--    <style type="text/css">-->
<!--        .layui-table-cell{height:40px;line-height:40px;}-->
<!--    </style>-->
</head>
<body>
<!--数据列表-->
<table class="layui-hide" id="test" lay-filter="qiye-table"></table>
<script src="../../js/layui.2.6.8/layui.js"></script>
<script src="../../js/token.js"></script>
<script src="../../js/config.js"></script>
<script>
    //url 传参
    function GetQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var a = decodeURI(window.location.search);
        var r = a.substr(1).match(reg);//search,查询？后面的参数，并匹配正则
        if(r!=null)return  unescape(r[2]); return null;
    }

    layui.use(['table','upload', 'element', 'dropdown'], function() {
        var $ = layui.$;
        var table = layui.table;

        table.render({
            elem: '#test'
            , id: 'staff-table-id'//重载需要
            , url: HOST+'staffQiyeChangeRecord/getChangeRecord?staffID='+GetQueryString("staffID")
            , title: '员工表'
            ,toolbar: '#tb'
            , cols: [[
                {type: 'numbers',title: '序号',width : 60}
                , {field: 'bh',align : 'center',width : 125, title: '员工编号',templet: function(res){
                    if (res.staff == null){
                        return ""
                    }else{
                        return res.staff.bh
                    }}}
                , {field: 'name', width: 125, align: 'center', title: '姓名',templet: function (res) {
                    if (res.staff == null){
                        return ""
                    }else{
                        return res.staff.name
                    }}}
                , {field: '', width: 130, align: 'center', title: '修改前企业',templet: function (res) {
                    if (res.beforeQiye == null){
                        return ""
                    }else{
                        return res.beforeQiye.qyname
                    }}}
                , {field: '', width: 130, align: 'center', title: '修改前物业',templet: function (res) {
                        if (res.beforeWuye == null){
                            return ""
                        }else{
                            return res.beforeWuye.wyname
                        }}}
                , {field: '', width: 130, align: 'center', title: '修改后企业',templet: function (res) {
                    if (res.afterQiye == null){
                        return ""
                    }else{
                        return res.afterQiye.qyname
                    }}}
                , {field: '', width: 130, align: 'center', title: '修改后物业',templet: function (res) {
                    if (res.afterWuye == null){
                        return ""
                    }else{
                        return res.afterWuye.wyname
                    }}}
                , {field: 'operDate',align : 'center',width : 170, title: '变更时间'}
            ]]
            , page: true
        });
    })
</script>

<script>
    function previewImgs(obj) {
        var img = new Image();
        img.src = obj.src;
        //var height = img.height + 50; // 原图片大小
        //var width = img.width; //原图片大小
        var imgHtml = "<img src='" + obj.src + "' width='800px' height='500px'/>";
        //弹出层
        layer.open({
            type: 1,
            shade: 0.8,
            offset: 'auto',
            area: [800 + 'px', 550 + 'px'],// area: [width + 'px',height+'px'],  //原图显示
            shadeClose: true,
            scrollbar: false,
            title: "图片预览", //不显示标题
            content: imgHtml, //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
            cancel: function () {
                //layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构', { time: 5000, icon: 6 });
            }
        });
    }
</script>
</body>
</html>